$(function(){
	$.post("../../ordStore/findAll.action",function(msg){
		var htmlStr="";
		for(var i=0;i<msg.length;i++){
			htmlStr+='<li><input type="radio" value="'+msg[i].stId
			+'" name="stId" id="cd-radio-'+1+'">'+
			'<label for="cd-radio-'+i+'">'+msg[i].stName+'</label></li>';
		}
		$("#shopType").html(htmlStr);
		$("#open").click(function(){
			$("#falseType").html("");
			$("#falsePicture").html("");
			$("#falseSite").html("");
			if ($.trim($('input:radio[name="stId"]:checked').val()).length == 0) {
		            $("#falseType").html("<font size='3px' color='red'>× 请选择店铺类型</font>");
		    }
			if ($("#fsPicture").val().length == "") {
	            $("#falsePicture").html("<font size='3px' color='red'>× 请上传店铺图片</font>");
	        }
			if ($.trim($("#city").val()).length == 0) {
	            $("#falseSite").html("<font size='3px' color='red'>× 请选择开店地址</font>");
	        }
			var ok=true;
			$('.errorMess').each(function(){
				if($(this).html()!=''){
					ok=false;
					return ok;
				}
			});
			if(ok){
				var url = "../../foodStore/addShop.action";
				var data = $("#openShop").serialize();
				$.post(url,data,function(msg){
					cover.style.display="block";   //显示遮罩层
					$("#shopUserMess").fadeIn(); 
					$("#usName").html(msg.usersName);
					$("#usPwd").html(msg.usersPwd);
				},"json");
			}
		});
	},"json");
	notNull("#fsName", "#falseName");
	notNull("#fsPerson", "#falsePerson");
	userTel("#fsPhone", "#falsePhone");
})